import random

num = random.randint(1, 100)
print(f"random的值为：{num}")
"""
i = 1
guess_num = int(input("请输入你猜想的数字："))
while guess_num != num:
    i += 1
    if guess_num > num:
        print("猜大了")
        guess_num = int(input("请输入你猜想的数字："))
    else:
        print("猜小了")
        guess_num = int(input("请输入你猜想的数字："))

print("恭喜你，猜对了")
print("你一共猜了：%s 次" % i)
"""

count = 0
flag = True
while flag:
    guess_num = int(input("请输入你猜想的数字："))
    count += 1
    if guess_num == num:
        print("猜对了")
        flag = False
    else:
        if guess_num > num:
            print("猜大了")
        else:
            print("猜小了")
print("你一共猜了 %s 次" % count)
